//
//  BackgroundRes.h
//  CandyJump
//
//  Created by Bon Lam on 02/04/2011.
//  Copyright 2011 Peru Republic. All rights reserved.
//

//=====================================================================================================================
@interface BackgroundInfo : NSObject
{
	float			gravity;
	NSString		*pattern;
}

//---------------------------------------------------------------------------------------------------------------------
@property (nonatomic, assign, readonly) float gravity;
@property (nonatomic, retain, readonly) NSString* pattern;

@end

@class BackgroundObject;
//=====================================================================================================================
@interface BackgroundRes : NSObject <NSXMLParserDelegate>
{
	BackgroundInfo		*backgroundInfo;
	NSMutableArray		*backgroundModelArray;
	
	BackgroundObject	*currentReadingObject;
}

//---------------------------------------------------------------------------------------------------------------------
@property (nonatomic, retain, readonly) BackgroundInfo *backgroundInfo;
@property (nonatomic, retain, readonly) NSMutableArray *backgroundModelArray;

#pragma mark -
#pragma mark BackgroundRes - Singleton
- (id)init;
- (void)dealloc;
+ (id)allocWithZone:(NSZone *)zone;
- (id)copyWithZone:(NSZone *)zone;
- (id)retain;
- (NSUInteger)retainCount;
- (void)release;
- (id)autorelease;

#pragma mark BackgroundRes - Custom Functions
+ (BackgroundRes *)sharedRes;
- (void)loadBackground:(NSString*)backgroundName;
- (void)unloadBackground;

#pragma mark BackgroundRes - NSXMLParserDelegate
- (BOOL)parseXMLFile:(NSString *)filename;
- (void)parseXMLData:(NSData *)data parseError:(NSError **)error;
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict;
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName;
- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError;
- (void)parserDidEndDocument:(NSXMLParser *)parser;

@end
